import 'package:flutter/material.dart';
import 'package:treadmill/pages/ranking_list_page.dart';
import 'package:treadmill/values/colors.dart';

class MinePage extends StatefulWidget {
  @override
  _MinePageState createState() => _MinePageState();
}

class _MinePageState extends State<MinePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: Text("我的"),
        centerTitle: true,
        //backgroundColor: Colors.blue[300],
      ),
      body: Column(
        children: <Widget>[
          Stack(
            children: <Widget>[
              Container(
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [minePageHeaderColor,Colors.grey[50]])
                ),
                height: 150,
                width: double.infinity,
              ),
              Container(
                width: double.infinity,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    CircleAvatar(
                      radius: 40,
                      child: Icon(
                        Icons.directions_bike,
                        size: 50,
                      ),
                    ),
                    SizedBox(
                      height: 10,
                    ),
                    Text(
                      '老爷',
                      style: TextStyle(fontSize: 20, color: Colors.white),
                    )
                  ],
                ),
              )
            ],
          ),
          Expanded(
              flex: 1,
              child: ListView(
                children: <Widget>[
                  ListTile(
                    leading: Icon(Icons.border_color,color: Colors.green[500],),
                    title: Text("运动记录"),
                    trailing: Icon(Icons.arrow_forward_ios),
                    subtitle:Text("查看我的全部运动记录"),
                    onTap: (){

                    },
                  ),
                  ListTile(
                    leading: Icon(Icons.sort,color: Colors.blue,),
                    title: Text("排行榜"),
                    trailing: Icon(Icons.arrow_forward_ios),
                    subtitle:Text("我的排行记录"),
                    onTap: (){
                      Navigator.of(context).push(MaterialPageRoute(builder:(context){
                        return RankingListPage();
                      }));
                    },
                  ),
                  ListTile(
                    leading: Icon(Icons.live_help,color:Colors.redAccent),
                    title: Text("常见问题"),
                    trailing: Icon(Icons.arrow_forward_ios),
                    subtitle:Text("系统帮助？"),
                    onTap: (){
                      //TODO 系统帮助
                    },
                  ),
                  ListTile(
                    leading: Icon(Icons.settings_applications,color: Colors.blueGrey,),
                    title: Text("设置"),
                    trailing: Icon(Icons.arrow_forward_ios),
                    subtitle:Text("系统安全、参数设置"),
                    onTap: (){
                      //TODO 系统安全、参数设置
                    },
                  ),

                ],
              ))
        ],
      ),
    );
  }
}
